


/*快速排序*/

void quick_sort(ElemType *arr,int low,int high)
{
	int base_point;
	
	if(low < high)
	{
		base_point = partiton();//计算基准点
		
		quick_sort(arr,low,base_point - 1);
		quick_sort(arr,base_point + 1,high);
		
	}
}

/*交换两个数据*/
void swap(ElemType *arr,int low,int high)
{
	int temp;
	
	temp = arr[low];
	arr[low] = arr[high];
	arr[high] = temp;
}

/*计算基准点*/
int partiton(ElemType *arr,int low,int high)
{
	int point;
	
	point = arr[low];
	
	while(low < high)
	{
		//比较右边
		while(low < high && arr[high] >= point)
		{
			high--;
		}
		swap(arr,low,high);
		
		//比较左边
		while(low < high && arr[high] <= point)
		{
			low++;
		}
		swap(arr,low,high);
		
	}
	return point;
}